<!DOCTYPE html>
<title>Tests that the closed captions icon is shown in the correct locales.</title>
<script src='../../resources/testharness.js'></script>
<script src='../../resources/testharnessreport.js'></script>
<script src='../media-controls.js'></script>
<body>
<script>
  const expectedClass = 'closed-captions';

  const testCases = [
    { locale: "ar", expected: false },
    { locale: "am", expected: false },
    { locale: "bg", expected: false },
    { locale: "bn", expected: false },
    { locale: "ca", expected: false },
    { locale: "cs", expected: false },
    { locale: "da", expected: false },
    { locale: "de", expected: false },
    { locale: "el", expected: false },
    { locale: "en", expected: true },
    { locale: "en-GB", expected: false },
    { locale: "en-US", expected: true },
    { locale: "es", expected: false },
    { locale: "es-419", expected: true },
    { locale: "et", expected: false },
    { locale: "fa", expected: false },
    { locale: "fi", expected: false },
    { locale: "fil", expected: false },
    { locale: "fr", expected: false },
    { locale: "gu", expected: false },
    { locale: "he", expected: false },
    { locale: "hi", expected: false },
    { locale: "hr", expected: false },
    { locale: "hu", expected: false },
    { locale: "id", expected: false },
    { locale: "it", expected: false },
    { locale: "ja", expected: false },
    { locale: "kn", expected: false },
    { locale: "ko", expected: false },
    { locale: "lt", expected: false },
    { locale: "lv", expected: false },
    { locale: "ml", expected: false },
    { locale: "mt", expected: false },
    { locale: "ms", expected: false },
    { locale: "nl", expected: false },
    { locale: "no", expected: false },
    { locale: "pl", expected: false },
    { locale: "pt-BR", expected: true },
    { locale: "pt-PT", expected: false },
    { locale: "ro", expected: false },
    { locale: "ru", expected: false },
    { locale: "sk", expected: false },
    { locale: "sl", expected: false },
    { locale: "sr", expected: false },
    { locale: "sv", expected: false },
    { locale: "sw", expected: false },
    { locale: "ta", expected: false },
    { locale: "te", expected: false },
    { locale: "th", expected: false },
    { locale: "tr", expected: false },
    { locale: "uk", expected: false },
    { locale: "vi", expected: false },
    { locale: "zh-CN", expected: false },
    { locale: "zh-TW", expected: false },
  ];

  function runTest(t) {
    if (window.internals)
      window.internals.setUserPreferredLanguages([t.properties.locale]);

    const video = document.createElement('video');
    video.controls = true;
    document.body.appendChild(video);

    assert_equals(
        captionsOverflowItem(video).classList.contains(expectedClass),
        t.properties.expected);
  }

  testCases.forEach((testCase) => {
    test(runTest, testCase.locale, testCase);
  });
</script>
